package ControlLayer;
import ModelLayer.Product;
import DBLayer.DBProduct;
import java.util.ArrayList;

public class CtrProduct {
    // <editor-fold defaultstate="collapsed" desc="Attributes & Constructors">
    private static CtrProduct instance = null;
    DBProduct dbProduct = new DBProduct();

    public CtrProduct() {
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Methods">
    public static CtrProduct getInstance() {
        if (instance == null) {
            instance = new CtrProduct();
        }
        return instance;
    }

    public ArrayList<Product> getProductList() {
        return dbProduct.getProductList();
    }

    public Product getProductByID(int id) {
        return dbProduct.getProductByID(id);
    }

    public int addProduct(Product product) {
        return dbProduct.addProduct(product);
    }

    public int updateProduct(Product product, int id) {
        return dbProduct.updateProduct(product, id);
    }

    public void deleteProduct(int id) {
        dbProduct.deleteProduct(id);
    }
    // </editor-fold>

}
